import os

def size(file):
    s = os.path.getsize ( file )
    print ( s )
    return (s)

size ( r'C:\Users\zhangqiang\Desktop\新建文件夹\Abc\Abc.txt' )

s=0
def get_size(dir):
    global s
    dlist = os.listdir ( dir )
    for f in dlist:
        file = os.path.join ( dir,f )
        if os.path.isfile(file):
            s = s+size ( file )
            print(s)
        if os.path.isdir ( file ):
            get_size ( file )

get_size (r'./Abc' )
